package com.emr.common;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;

/**
 * 文件操作类
 * @author Hearken
 * @date Jul 27, 2009 10:19:41 AM
 */
public class FileOperation {
	
	/**
	 * 新建目录
	 * @param folderPath:如c:/fqf
	 * @return boolean
	 */
	public boolean newFolder(String folderPath) {
		boolean isSuccess = false;
		try {
			String filePath = folderPath;
			filePath = filePath.toString();
			File myFilePath = new File(filePath);
			if (!myFilePath.exists()) {
				isSuccess = myFilePath.mkdir();
			} else {
				isSuccess = true;
			}
		} catch (Exception e) {
			isSuccess = false;
			System.out.println("新建目录操作出错");
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 新建多级目录
	 * @param path
	 * @return boolean
	 */
	public boolean newClassFolder(String path) {
		boolean isSuccess = false;
		try {
			StringTokenizer st = new StringTokenizer(path, "/");
			String path1 = st.nextToken() + "/";
			String path2 = path1;
			while (st.hasMoreTokens()) {
				path1 = st.nextToken() + "/";
				path2 += path1;
				File inbox = new File("/" + path2);
				if (!inbox.exists()) {
					inbox.mkdir();
				}
			}
			isSuccess = true;
		} catch (Exception e) {
			isSuccess = false;
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 新建多级目录
	 * @param path:路径
	 * @param separator:"/" or "\"
	 * @return boolean
	 */
	public boolean newClassFolder(String path, String separator) {
		boolean isSuccess = false;
		try {
			StringTokenizer st = new StringTokenizer(path, separator);
			String path1 = st.nextToken() + separator;
			String path2 = path1;
			while (st.hasMoreTokens()) {
				path1 = st.nextToken() + separator;
				path2 += path1;
				File inbox = new File(path2);
				if (!inbox.exists()) inbox.mkdir();
			}
			isSuccess = true;
		} catch (Exception e) {
			isSuccess = false;
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 新建文件
	 * @param filePathAndName:文件路径及名称如c:/fqf.txt
	 * @param fileContent:文件内容
	 * @return boolean
	 */
	public boolean newFile(String filePathAndName, String fileContent) {
		boolean isSuccess = false;
		try {
			String filePath = filePathAndName;
			filePath = filePath.toString();
			File myFilePath = new File(filePath);
			if (!myFilePath.exists()) {
				myFilePath.createNewFile();
			}
			FileWriter resultFile = new FileWriter(myFilePath);
			PrintWriter myFile = new PrintWriter(resultFile);
			String strContent = fileContent;
			myFile.println(strContent);
			resultFile.close();
			isSuccess = true;
		} catch (Exception e) {
			isSuccess = false;
			System.out.println("新建文件操作出错");
			e.printStackTrace();
		}
		
		return isSuccess;
	}
	
	/**
	 * 删除文件
	 * @param filePathAndName:文件路径及名称如c:/fqf.txt
	 * @param fileContent
	 * @return boolean
	 */
	public boolean deleteFile(String filePathAndName) {
		boolean isSuccess = false;
		try {
			String filePath = filePathAndName;
			filePath = filePath.toString();
			File file = new File(filePath);
			if (file.exists() && file.isFile()) {
				isSuccess = file.delete();
				if (!isSuccess) {
					isSuccess = file.delete();
				}
			} else {
				isSuccess = false;
			}
		} catch (Exception e) {
			isSuccess = false;
			System.out.println("删除文件操作出错");
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 删除文件夹
	 * @param filePathAndName:文件夹路径及名称 如c:/fqf
	 * @param fileContent
	 * @return boolean
	 */
	public boolean deleteFolder(String folderPath) {
		boolean isSuccess = false;
		try {
			deleteAllFile(folderPath); // 删除完里面所有内容
			String filePath = folderPath;
			filePath = filePath.toString();
			File myFilePath = new File(filePath);
			myFilePath.delete(); // 删除空文件夹
			
			if (myFilePath.exists()) {
				isSuccess = false;
			} else {
				isSuccess = true;
			}
		} catch (Exception e) {
			isSuccess = false;
			System.out.println("删除文件夹操作出错");
			e.printStackTrace();
		}
		
		return isSuccess;
	}
	
	/**
	 * 删除目录
	 * @param dir
	 * @return
	 */
	public boolean deleteDirectory(String dir) {
		// 如果dir不以文件分隔符结尾，自动添加文件分隔符
		if (!dir.endsWith("/")) {
			dir = dir + "/";
		}
		File dirFile = new File(dir);
		// 如果dir对应的文件不存在，或者不是一个目录，则退出
		if (!dirFile.exists() || !dirFile.isDirectory()) {
			System.out.println("删除目录失败" + dir + "目录不存在！");
			return false;
		}
		boolean flag = true;
		// 删除文件夹下的所有文件(包括子目录)
		File[] files = dirFile.listFiles();
		for (int i = 0; i < files.length; i++) {
			// 删除子文件
			if (files[i].isFile()) {
				String sTemp = files[i].getAbsolutePath();
				sTemp = sTemp.replace("\\", "/");
				flag = deleteFile(sTemp);
				if (!flag) {
					break;
				}
			}
			// 删除子目录
			else {
				String sTemp = files[i].getAbsolutePath();
				sTemp = sTemp.replace("\\", "/");
				flag = deleteDirectory(sTemp);
				if (!flag) {
					break;
				}
			}
		}
		if (!flag) {
			System.out.println("删除目录失败");
			return false;
		}
		// 删除当前目录
		if (dirFile.delete()) {
			System.out.println("删除目录" + dir + "成功！");
			return true;
		} else {
			System.out.println("删除目录" + dir + "失败！");
			return false;
		}
	}
	
	/**
	 * 删除文件夹里面的所有文件
	 * @param path:文件夹路径如c:/fqf
	 */
	public void deleteAllFile(String path) {
		File file = new File(path);
		if (!file.exists()) { return; }
		if (!file.isDirectory()) { return; }
		String[] tempList = file.list();
		File temp = null;
		for (int i = 0; i < tempList.length; i++) {
			if (path.endsWith("/")) {
				temp = new File(path + tempList[i]);
			} else {
				temp = new File(path + "/" + tempList[i]);
			}
			if (temp.isFile()) {
				System.out.println("删除文件=" + temp.getAbsolutePath());
				temp.delete();
			} else if (temp.isDirectory()) {
				deleteAllFile(path + "/" + tempList[i]);// 先删除文件夹里面的文件
				deleteFolder(path + "/" + tempList[i]);// 再删除空文件夹
			}
		}
	}
	
	/**
	 * 复制单个文件
	 * @param oldPath:原文件路径如:c:/fqf.txt
	 * @param newPath:复制后路径如:f:/fqf.txt
	 * @return boolean
	 */
	public boolean copyFile(String oldPath, String newPath) {
		boolean isSuccess = false;
		try {
			int bytesum = 0;
			int byteread = 0;
			File oldfile = new File(oldPath);
			// System.out.println("oldfile=" + oldfile.exists());
			if (oldfile.exists()) { // 文件存在时
				InputStream inStream = new FileInputStream(oldPath); // 读入原文件
				FileOutputStream fs = new FileOutputStream(newPath);
				byte[] buffer = new byte[99999];
				while ((byteread = inStream.read(buffer)) != -1) {
					bytesum += byteread; // 字节数 文件大小
					fs.write(buffer, 0, byteread);
				}
				fs.flush();
				fs.close();
				inStream.close();
				buffer = null;
				isSuccess = true;
			} else {
				System.out.println("要复制的文件不存在！");
				isSuccess = false;
			}
		} catch (Exception e) {
			isSuccess = false;
			System.out.println("复制单个文件操作出错");
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 复制整个文件夹内容
	 * @param oldPath:原文件路径 如:c:/fqf
	 * @param newPath:复制后路径 如:f:/fqf/ff
	 * @return boolean
	 */
	public boolean copyFolder(String oldPath, String newPath) {
		boolean isSuccess = false;
		try {
			(new File(newPath)).mkdirs(); // 如果文件夹不存在 则建立新文件夹
			File a = new File(oldPath);
			String[] file = a.list();
			File temp = null;
			for (int i = 0; i < file.length; i++) {
				if (oldPath.endsWith(File.separator)) {
					temp = new File(oldPath + file[i]);
				} else {
					temp = new File(oldPath + File.separator + file[i]);
				}
				if (temp.isFile()) {
					FileInputStream input = new FileInputStream(temp);
					FileOutputStream output = new FileOutputStream(newPath + "/" + (temp.getName()).toString());
					byte[] b = new byte[1024 * 5];
					int len;
					while ((len = input.read(b)) != -1) {
						output.write(b, 0, len);
					}
					output.flush();
					output.close();
					input.close();
				}
				if (temp.isDirectory()) {// 如果是子文件夹
					copyFolder(oldPath + "/" + file[i], newPath + "/" + file[i]);
				}
			}
			isSuccess = true;
		} catch (Exception e) {
			isSuccess = false;
			System.out.println("复制整个文件夹内容操作出错");
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 移动文件到指定目录
	 * @param oldPath:如:c:/fqf.txt
	 * @param newPath:如:d:/fqf.txt
	 */
	public boolean moveFile(String oldPath, String newPath) {
		boolean isSuccess = false;
		if (copyFile(oldPath, newPath)) {
			isSuccess = deleteFile(oldPath);
		} else {
			isSuccess = false;
		}
		return isSuccess;
	}
	
	/**
	 * 移动文件夹到指定目录
	 * @param oldPath:如:c:/fqf.txt
	 * @param newPath:如:d:/fqf.txt
	 */
	public boolean moveFolder(String oldPath, String newPath) {
		boolean isSuccess = false;
		if (copyFolder(oldPath, newPath)) {
			isSuccess = deleteFolder(oldPath);
		} else {
			isSuccess = false;
		}
		
		return isSuccess;
	}
	
	/**
	 * 读取文本文件（只能读取10万行）
	 * @param filePath
	 * @return
	 */
	public StringBuffer readTextFile(String filePath) {
		StringBuffer sBuffer = null;
		try {
			sBuffer = new StringBuffer();
			File file = new File(filePath);
			if (file != null && file.exists()) {
				FileInputStream fis = new FileInputStream(filePath);
				InputStreamReader isr = new InputStreamReader(fis, "GBK");
				
				BufferedReader br = new BufferedReader(isr);
				String sLine = "";
				int iCount = 0, iReadMaxCount = 100000;
				while ((sLine = br.readLine()) != null) {
					if (iCount > 0) {
						sBuffer.append("\n" + sLine);
					} else {
						sBuffer.append(sLine);
					}
					iCount++;
					if (iCount >= iReadMaxCount) {
						break;// 防止死循环和内存溢出
					}
				}
				fis.close();
				isr.close();
				br.close();
			} else {
				sBuffer = null;
			}
		} catch (Exception e) {
			e.printStackTrace();
			sBuffer = null;
		}
		return sBuffer;
	}
	
	/**
	 * 读取文本文件
	 * @param filePath
	 * @param sEncoding
	 * @return
	 */
	public StringBuffer readTextFile(String filePath, String sEncoding) {
		StringBuffer sBuffer = null;
		try {
			sBuffer = new StringBuffer();
			File file = new File(filePath);
			if (file != null && file.exists()) {
				FileInputStream fis = new FileInputStream(filePath);
				InputStreamReader isr = new InputStreamReader(fis, sEncoding);
				
				BufferedReader br = new BufferedReader(isr);
				String sLine = "";
				int iCount = 0;
				while ((sLine = br.readLine()) != null) {
					if (iCount > 0) {
						sBuffer.append("\n" + sLine);
					} else {
						sBuffer.append(sLine);
					}
					iCount++;
				}
				fis.close();
				isr.close();
				br.close();
			} else {
				sBuffer = null;
			}
		} catch (Exception e) {
			e.printStackTrace();
			sBuffer = null;
		}
		return sBuffer;
	}
	
	/**
	 * 保存文本文件
	 * @param filePath
	 * @param buffer
	 * @return
	 */
	public boolean saveTextFile(String filePath, StringBuffer buffer) {
		boolean isSuccess = false;
		try {
			File file = new File(filePath);
			if (!file.exists()) {
				file.createNewFile();
			}
			BufferedWriter output = new BufferedWriter(new FileWriter(file));
			output.write(buffer.toString());
			output.close();
			buffer = null;
			isSuccess = true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 获取文件大小
	 * @param sPath
	 * @return
	 */
	public double getFileByte(String sPath) {
		double fileByte = 0.0;
		try {
			FileInputStream fis = new FileInputStream(sPath);
			fileByte = fis.available();
			fis.close();
		} catch (Exception e) {
			System.out.println("获取文件大小出错");
			e.printStackTrace();
		}
		return fileByte;
	}
	
	/**
	 * 将HTTP资源另存为文件
	 * @param downUrl:下载路径
	 * @param savePath:保存路径
	 * @return
	 */
	public boolean downloadToFile(String downUrl, String savePath) {
		boolean isSuccess = false;
		boolean DEBUG = true;// 调试用
		int BUFFER_SIZE = 1024 * 200;// 缓冲区大小1KB=1024B
		FileOutputStream fos = null;
		BufferedInputStream bis = null;
		HttpURLConnection httpUrl = null;
		URL url = null;
		byte[] buf = new byte[BUFFER_SIZE];
		int size = 0;
		try {
			// 建立链接
			url = new URL(downUrl);
			httpUrl = (HttpURLConnection) url.openConnection();
			// 连接指定的资源
			httpUrl.connect();
			// 获取网络输入流
			bis = new BufferedInputStream(httpUrl.getInputStream());
			// 建立文件
			fos = new FileOutputStream(savePath);
			if (DEBUG) {
				System.out.println("正在获取链接[" + downUrl + "]的内容...\n将其保存为文件[" + savePath + "]");
			}
			// 保存文件
			while ((size = bis.read(buf)) != -1) {
				fos.write(buf, 0, size);
			}
			fos.close();
			bis.close();
			httpUrl.disconnect();
			isSuccess = true;
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 检查文件是否存在
	 * @param filePath
	 * @return
	 */
	public boolean checkFileExist(String filePath) {
		boolean isSuccess = false;
		try {
			File file = new File(filePath);
			isSuccess = file.exists();
			file = null;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return isSuccess;
	}
	
	/**
	 * 打开文件
	 * @param sFilePath
	 */
	public boolean openFile(String sFilePath) {
		boolean mark = false;
		try {
			Properties properties = System.getProperties();
			String osName = properties.getProperty("os.name");
			if (osName.indexOf("Linux") != -1) {
				Runtime.getRuntime().exec("shell /c \"" + sFilePath + "\"");
			} else if (osName.indexOf("Windows") != -1) {
				Runtime.getRuntime().exec("cmd /c \"" + sFilePath + "\"");
			} else {
				throw new RuntimeException("Unknown OS.");
			}
			mark = true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return mark;
	}
	
	/**
	 * 获取文件列表
	 * @param sDirPath:目录路径
	 * @return
	 */
	public File[] getFileList(String sDirPath) {
		File[] fileList = null;
		try {
			File file = new File(sDirPath);
			if (file.exists() && file.isDirectory()) {
				fileList = file.listFiles();
			}
		} catch (RuntimeException e) {
			e.printStackTrace();
		}
		return fileList;
	}
	
	/**
	 * 读取文本内容到list对象
	 * @param filePath
	 * @return
	 */
	public List<?> readTextToList(String filePath) {
		int iCount = 0, iMaxCount = 9999999;
		ArrayList<String> list = new ArrayList<String>();
		try {
			FileReader fr = new FileReader(filePath);
			BufferedReader br = new BufferedReader(fr);
			String sLine;
			try {
				while ((sLine = br.readLine()) != null) {
					if ("".equals(sLine)) {
						continue;
					}
					list.add(sLine);
					if (++iCount > iMaxCount) {
						// 防止死循环，只读取1千万行
						break;
					}
				}
				br.close();
				fr.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		return list;
	}
	
	/**
	 * 读取文本文件
	 * @param filePath（文件路径+文件名称）
	 * @param elementRegex（一行中的元素分割符）（通常为
	 *            \t）
	 * @return
	 */
	public List<?> readTextToList(String filePath, String elementRegex) {
		int iCount = 0, iMaxCount = 9999999;
		ArrayList<String[]> list = new ArrayList<String[]>();
		try {
			FileReader fr = new FileReader(filePath);
			BufferedReader br = new BufferedReader(fr);
			String sLine;
			try {
				while ((sLine = br.readLine()) != null) {
					if ("".equals(sLine)) {
						continue;
					}
					sLine = sLine.replace("\n", "");// 读取行后替换掉行分割符
					// 以正则表达式分割该行元素，-1可以分割出空元素
					String[] elementArr = sLine.split(elementRegex, -1);
					list.add(elementArr);
					if (++iCount > iMaxCount) {
						// 防止死循环，只读取1千万行
						break;
					}
				}
				br.close();
				fr.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
			list = null;
		}
		return list;
	}

	/**
	 * 读取文本文件
	 * @param filePath（文件路径+文件名称）
	 * @param elementRegex（一行中的元素分割符）（通常为
	 *            \t）
	 * @return
	 */
	public List<?> readTextToList(File file, String elementRegex) {
		int iCount = 0, iMaxCount = 9999999;
		ArrayList<String[]> list = new ArrayList<String[]>();
		try {
			FileReader fr = new FileReader(file);
			BufferedReader br = new BufferedReader(fr);
			String sLine;
			try {
				while ((sLine = br.readLine()) != null) {
					if ("".equals(sLine)) {
						continue;
					}
					sLine = sLine.replace("\n", "");// 读取行后替换掉行分割符
					// 以正则表达式分割该行元素，-1可以分割出空元素
					String[] elementArr = sLine.split(elementRegex, -1);
					list.add(elementArr);
					if (++iCount > iMaxCount) {
						// 防止死循环，只读取1千万行
						break;
					}
				}
				br.close();
				fr.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (Exception e) {
			e.printStackTrace();
			list = null;
		}
		return list;
	}
	
	/**
	 * 读取文本内容到List对象
	 * @param filePath
	 * @return
	 */
	public List<ArrayList<String>> readTextToList(File file) {
		int iCount = 0, iMaxCount = 9999999;
		String sTemp = "", sValue = "";
		ArrayList<ArrayList<String>> list = new ArrayList<ArrayList<String>>();
		try {
			FileReader fr = new FileReader(file);
			BufferedReader br = new BufferedReader(fr);
			String sLine;
			try {
				while ((sLine = br.readLine()) != null) {
					if ("".equals(sLine)) {
						continue;
					}
					sTemp = "";
					sValue = "";
					long lLen = sLine.length();
					ArrayList<String> listObj = new ArrayList<String>();
					for (int i = 0; (long) i < lLen; i++) {
						sTemp = sLine.substring(i, i + 1);
						char cChar = sTemp.charAt(0);
						if (cChar == '\t' || cChar == '\n' || cChar == '\r') {
							listObj.add(new String(sValue));
							sValue = "";
						} else {
							sValue = sValue + sTemp;
						}
					}
					listObj.add(new String(sValue));
					list.add(listObj);
					if (++iCount > iMaxCount) {
						// 防止死循环，只读取1千万行
						break;
					}
				}
				br.close();
				fr.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		return list;
	}
	
	/**
	 * 获取文件字节流
	 * @param file
	 * @return
	 */
	public byte[] getBytesFromFile(File file) {
		byte[] fileByte = null;
		if (file == null) { return fileByte; }
		try {
			int iLen = 200 * 1024;
			FileInputStream stream = new FileInputStream(file);
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			byte[] b = new byte[iLen];
			int n;
			while ((n = stream.read(b)) != -1) {
				out.write(b, 0, n);
			}
			stream.close();
			out.flush();
			out.close();
			fileByte = out.toByteArray();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return fileByte;
	}
	
	/**
	 * 文件转换成字节流
	 * @param filePath
	 * @return
	 */
	public byte[] fileToBytes(String filePath) {
		byte[] fileByte = null;
		if (filePath == null || filePath.length() < 1) { return fileByte; }
		File file = new File(filePath);
		if (file == null || !file.exists()) { return fileByte; }
		return getBytesFromFile(file);
	}
	
	/**
	 * 字节流转换成文件
	 * @param fileByte
	 * @param outputFilePath
	 * @return
	 */
	public File byteToFile(byte[] fileByte, String outputFilePath) {
		File file = null;
		BufferedOutputStream stream = null;
		if (fileByte == null || fileByte.length < 1) { return file; }
		try {
			file = new File(outputFilePath);
			FileOutputStream fos = new FileOutputStream(file);
			stream = new BufferedOutputStream(fos);
			stream.write(fileByte);
			stream.close();
			fos.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return file;
	}
	
	/**
	 * 字节流转换成对象
	 * @param objByte
	 * @return
	 */
	public Object byteToObject(byte[] objByte) {
		Object obj = null;
		if (objByte == null || objByte.length == 0) { return obj; }
		try {
			ByteArrayInputStream bais = new ByteArrayInputStream(objByte);
			ObjectInputStream ois = new ObjectInputStream(bais);
			obj = ois.readObject();
			ois.close();
			bais.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return obj;
	}
	
	/**
	 * 获取文件夹下的文件列表
	 * @param sFolderPath
	 * @return
	 */
	public List<String> getFolderFileList(String sFolderPath) {
		List<String> list = new ArrayList<String>();
		findFile(list, new File(sFolderPath));
		return list;
	}
	
	/**
	 * 查找文件
	 * @param list
	 * @param file
	 */
	private void findFile(List<String> list, File file) {
		File[] files = file.listFiles();
		if (files == null) {
			return;
		} else {
			for (int i = 0; i < files.length; i++) {
				if (files[i].isDirectory()) {
					findFile(list, files[i].getAbsoluteFile());
				} else {
					list.add(files[i].getAbsolutePath());
				}
			}
		}
	}
	
	public static void main(String[] args) {
		FileOperation fo = new FileOperation();
		// StringBuffer bf = fo.readTextFile("c:/test.txt");
		// System.out.println("---------------------------");
		// System.out.println(bf.toString());
		// System.out.println("---------------------------");
		// fo.openFile("");
		// fo.readTextToList("c:/test.txt");
		// fo.downloadToFile("http://amin.com.sg/jOmino/js/jquery.jomino.js",
		// "c:/jomino.js");
		byte[] fileByte = fo.fileToBytes("c:/测试.zip");
		System.out.println("fileByte=" + fileByte);
		File file = fo.byteToFile(fileByte, "d:/测试.zip");
		System.out.println("file=" + file);
	}
}